package com.ruoyi.system.service.impl;

import com.ruoyi.system.mapper.ReportMapper;
import com.ruoyi.system.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ReportServiceImpl implements ReportService {
    @Autowired
    private ReportMapper reportMapper;

    @Override
    public List<Map<String, Object>> selectLaunchByMaterial(Long pointId, Long trashId,String launchDate) {
        return reportMapper.selectLaunchByMaterial(pointId,trashId,launchDate);
    }

    @Override
    public List<Map<String, Object>> selectLaunchByPoint(String launchDate) {
        return reportMapper.selectLaunchByPoint(launchDate);
    }

    @Override
    public List<Map<String, Object>> selectLaunchByDate(Long pointId, Long trashId, String launchDate, Long materialId) {
        return reportMapper.selectLaunchByDate(pointId,trashId,launchDate,materialId);
    }

    @Override
    public List<Map<String, Object>> selectLaunchByType() {
        return reportMapper.selectLaunchByType();
    }

    @Override
    public List<Map<String, Object>> selectLaunchByMaterialId() {
        List<Map<String, Object>> result = reportMapper.selectLaunchByMaterialId();
        if (result != null && result.size() > 5){
            List<Map<String, Object>> subList = result.subList(0,5);
            return subList;
        }
        return result;
    }
}
